<?php
	use yii\helpers\Html;
	use yii\helpers\Url;
	use yii\widgets\ActiveForm;
	use yii\widgets\LinkPager;
?>

<div class="page-header">
	<h1>
		客户管理
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			客户列表
		</small>
	</h1>
	<div class="nav-search" style="right:126px;top:10px;" id="nav-search">
		<?php $form = ActiveForm::begin([
			'enableClientValidation' => true,
			'method' => 'get',
			'options' => ['class' => 'form-search'],
		])?>
			<span class="input-icon">
				<input type="text" name="Customer[name]" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
				<i class="ace-icon fa fa-search nav-search-icon"></i>
				<input type="submit" style="padding-right: 22px;margin-left: 20px;background: #438EB9;color: white;border: none;border-radius: 5px;" value="搜索">
			</span>
		<?php ActiveForm::end();?>

	</div>
</div><!-- /.page-header -->

<!-- PAGE CONTENT BEGINS -->
<div class="row">
	<div class="col-xs-12">
		<table id="simple-table" class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th class="center">id</th>
					<th class="hidden-480 cneter">登记时间</th>
					<th>客户名</th>
					<th>电话</th>
					<th>性别</th>
					<th class="hidden-480">最新跟进时间</th>
					<th>意向度</th>
					<th>跟办人</th>
					<th>审批</th>

				</tr>
			</thead>

			<tbody>
				<?php $i="1"?>
				<?php foreach($model as $mod):?>
				<tr>
					<td class="center"><?php echo $i;?></td>
					<td><?php echo date("Y-m-d",$mod->visitTime);?></td>
					<td><a href="<?= Url::to(['customer/edit','id'=>$mod->id])?>"><?php echo $mod->name;?></a></td>
					<td><?php echo $mod->phone;?></td>
					<td><?php echo $gender[$mod->gender];?></td>
					<td class="hidden-480">
						<span class="label label-sm label-warning"><?php echo date("Y-m-d,h:i:s",$mod->updateTime);?></span>
					</td>
					<td><?php echo isset($data['degree'][$mod->degree]) ? $data['degree'][$mod->degree] : "" ;?></td>									
					<td><?php echo $mod->sid;?></td>
					<td>
						<div class="hidden-sm hidden-xs btn-group">
							<?php if($mod->approval==0):?>
								<button class="btn btn-xs btn-info" id='J_Shen'>
									<a href="<?= Url::to(['customer/approval','id'=>$mod->id,'approval'=>$mod->approval,'page'=>isset($page)?$page:'','perpage'=>isset($perpage)?$perpage:''])?>" style="color:#FFFFFF"><i class="ace-icon fa fa-pencil bigger-120"></i></a>								
								</button>
							<?php endif;?>
							<?php if($mod->approval==1):?>
								已申请
							<?php endif;?>
							<?php if($mod->approval==2):?>
								通过
							<?php endif;?>
							<?php if($mod->approval==3):?>
								拒绝
							<?php endif;?>
						</div>
					</td>
				</tr>
				<?php $i++;?>
				<?php endforeach;?>

			</tbody>
		</table>
		<?= LinkPager::widget(['pagination'=>$pages]);?>
		
		<?php
			if(Yii::$app->session->hasFlash('info')):
		?>
			<script type="text/javascript">
				alert('<?php echo Yii::$app->session->getFlash('info')?>');
			</script>
		<?php endif?>
	</div><!-- /.span -->
</div><!-- /.row -->
<script src="./ace/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
	function del(id){
		if(window.confirm('确认要删除么?')){
			window.location.href = "<?php echo Url::toRoute(['content/del'])?>&id="+id;
		}
	}
</script>
<div class="hr hr-18 dotted hr-double"></div>




